/*
package cloud.xlh.infrastructure.service_register_recoverd.service.impl;

import cloud.xlh.infrastructure.service_register_recoverd.MyRegisterCenterProperties;
import cloud.xlh.infrastructure.service_register_recoverd.service.RegisterService;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.net.Inet4Address;
import java.net.UnknownHostException;

*/
/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2022/10/16 19:05
 * @ Description: 服务注册入口
 *//*


@Slf4j
@Configuration
@EnableConfigurationProperties(value = MyRegisterCenterProperties.class)
public class RegisterServiceImpl implements RegisterService{
    @Autowired
    private NamingService myNacosNamingService;
    //......其他注册中心注册行为，例如myEurekaNamingService;

    //自定义属性前缀
    @Autowired
    MyRegisterCenterProperties myRegisterCenterProperties;

    //由于PostConstruct的影响，MyRegisterCenterProperties不能够直接以参数的形式注入
    @Override
    //@PostConstruct
    public void registerInstance() throws NacosException {
        //获取应用名称
        String applicationName = myRegisterCenterProperties.getApplicationName();
        //获取服务所属IP
        String hostAddress = "127.0.0.1";
        try {
            hostAddress = Inet4Address.getLocalHost().getHostAddress();
            log.info("服务所属IP({})获取成功" , hostAddress);
        } catch (UnknownHostException e) {
            log.error("服务所属IP获取异常");
            e.printStackTrace();
        }
        //服务对应端口
        int serverPort = myRegisterCenterProperties.getServerPort();

        //不同的注册中心调用不同的注册入口
        myNacosNamingService.registerInstance(applicationName, hostAddress, serverPort);
    }

}
*/
